(function() {
	//获取时间并动态显示时间
	setInterval(function() {
		$.ajax({
			type:"get",
			url:"GetTime",
			async:true,
			dataType:"text",
			success:function(data){
				$('.time').html("<p>" + data + "</p>");
			}
		});
	}, 1000);

	//注册raido的click时间
	$('table').on("click", ":radio", function() {
		var scFiCount = 0,
			scFoCount = 0,
			scThCount = 0,
			scTwoCount = 0,
			scOneCount = 0;
		var scFi = 0,
			scFo = 0,
			scTh = 0,
			scTwo = 0,
			scOne = 0;

		$('.col5').each(function() {
			var _this_ = this;
			if(_this_.checked === true) scFiCount++;
		});

		$('.col4').each(function() {
			var _this_ = this;
			if(_this_.checked === true) scFoCount++;
		});

		$('.col3').each(function() {
			var _this_ = this;
			if(_this_.checked === true) scThCount++;
		});

		$('.col2').each(function() {
			var _this_ = this;
			if(_this_.checked === true) scTwoCount++;
		});

		$('.col1').each(function() {
			var _this_ = this;
			if(_this_.checked === true) scOneCount++;
		});

		scFi = 5 * scFiCount;
		scFo = 4 * scFoCount;
		scTh = 3 * scThCount;
		scTwo = 2 * scTwoCount;
		scOne = 1 * scOneCount;

		$('.score5').html(scFi);
		$('.score4').html(scFo);
		$('.score3').html(scTh);
		$('.score2').html(scTwo);
		$('.score1').html(scOne);
		$('.scoretotal').html(scFi + scFo + scTh + scTwo + scOne);
	});

	//注册专业和教师选择的click事件
	$('.appendli2').on("click", "input[name=allSelect1]", function() {
		if($('input[name=allSelect1]').prop("checked") === true) {
			$('input[name=checkMajor]').each(function() {
				var _this_ = this;
				$(_this_).prop("checked", true);
			});
		} else {
			$('input[name=checkMajor]').each(function() {
				var _this_ = this;
				$(_this_).prop("checked", false);
			});
		}
	});

	$('.appendli3').on("click", "input[name=allSelect2]", function() {
		if($('input[name=allSelect2]').prop("checked") === true) {
			$('input[name=chTeacher]').each(function() {
				var _this_ = this;
				$(_this_).prop("checked", true);
			});
		} else {
			$('input[name=chTeacher]').each(function() {
				var _this_ = this;
				$(_this_).prop("checked", false);
			});
		}
	});
	
	/*function getTime() {
		var d = new Date(),
			year = '',
			month = '',
			day = '',
			hour = '',
			minute = '',
			sec = '';
		year = d.getFullYear(); //获取年份
		month = d.getMonth() + 1; //获取当前月份(0-11)
		day = d.getDate();
		hour = d.getHours();
		minute = d.getMinutes();
		sec = d.getSeconds();

		if(month < 10) {
			month = '0' + month;
		}
		if(day < 10) {
			day = '0' + day;
		}
		if(hour < 10) {
			day = '0' + hour;
		}
		if(minute < 10) {
			minute = '0' + minute;
		}
		if(sec < 10) {
			sec = '0' + sec;
		}
		return year + "年" + month + "月" + day + "日 " + hour + ":" + minute + ":" + sec;
	};*/
})();